package com.larissa.android.quiz;

import android.content.Context;
import android.util.Log;

import java.util.ArrayList;
import java.util.List;

public class MainRepository {
    private final String TAG="QuestionRepository";            // debug log字符串

    private static MainRepository repository;
    public List<Question> historyQuestions;
    private MainRepository(Context context){
        Log.d(TAG, "QuestionRepository called");
        historyQuestions=new ArrayList<>();
    }

    public static MainRepository getInstance(){
        String TAG="QuestionRepository";            // debug log字符串
        Log.d(TAG, "getInstance called");
        if(repository==null)
            throw new IllegalStateException("QuestionRepository must be initialized!");
        return repository;
    }

    public static void initialize(Context context){
        if(repository==null)
            repository=new MainRepository(context);
    }
}
